In data processing systems, data is commonly encoded in a data format that facilitates the storage, processing, transmission and extraction of the data. With many such data formats, the encoded data needs to be processed in order to extract or decode the data for use by a user or other data processing system. Data extraction or decoding may be performed by a parser.
An example of a system for encoding data, commonly used in computer systems, uses a mark-up language such as Extensible Mark-up Language (XML). Parsers for mark-up language such as XML are commonly provided as Application Program Interfaces (APIs) and can generally be categorized as tree based or event based APIs. Tree based parser APIs map an XML document into an internal tree structure, and then allow another application, such as a web browser, to navigate that tree and extract the required data. Event-based parser APIs report parsing events, such as the start and end of data elements, directly via callbacks to another application such as a web browser, and do not usually build an internal tree. In both cases, the web browser that receives data encoded in XML uses the parser API to decode the XML. The XML may be supplied by a web server.
One problem with the above approaches is that they require significant memory or processor resources in order to perform the data extraction or decoding.